import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_xiaomi/generated/locales.g.dart';
import 'package:get/get.dart';
import 'app/routes/app_pages.dart';

void main() {
  runApp(
    XiaoMiApp(),
  );
}

class XiaoMiApp extends StatelessWidget {
  const XiaoMiApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    ///添加尺寸适配器
    return ScreenUtilInit(
      designSize: const Size(360, 690),  ///设计稿的宽高
      minTextAdapt: true, ///是否根据宽度/高度中的最小值适配文字
      splitScreenMode: true,///支持分屏尺寸
      builder: (context, child){ ///builder和child中必须填写至少一项
        return GetMaterialApp(
          debugShowCheckedModeBanner: false,
          theme: ThemeData(
            //在点击底部的Item时，会出现一个选中的波纹动画效果，这实际上是MaterialApp的一个属性设置
              primaryColor: Colors.greenAccent,
              highlightColor: Color.fromRGBO(0, 0, 0, 0),
              splashColor: Color.fromRGBO(0, 0, 0, 0)),
          title: "xiaomi",
          initialRoute: AppPages.INITIAL,
          getPages: AppPages.routes,
          translationsKeys: AppTranslation.translations,
          locale: const Locale('zh',
              'CN'), // 将会按照此处指定的语言翻译 fallbackLocale:const Locale('en', 'US'),
        );
      }
    );
  }
}
